<?php
/**
 * Created by PhpStorm.
 * User: zen
 * Date: 2017/2/27
 * Time: 18:45
 */
$headers = array(
    'X-AjaxPro-Method:ShowList',
    'Content-Type: application/json; charset=utf-8',
    'Content-Length: '.strlen('1111'),
    'w: 123',
    's: 123123',
);
try {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'http://demo.dev/index.php/api/test');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, '1111');
    $data = curl_exec($ch);
    $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    return array('data' => $data, 'http_code' => $http_code);
} catch (Exception $e) {
    exit($e->getMessage());
}